<?php
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
if(!isset($_SESSION['db'])){
	$addressbrowser = $_SERVER['SERVER_NAME'];
	$temp = explode(".", $addressbrowser);
	$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
	//$connection = mysql_connect("localhost", "root", "root" ) ;
	mysql_select_db("elihan", $connection);
	mysql_query("set names 'utf8'");
	$selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$temp[0]' and am.`Status` = 2");
	$result = mysql_fetch_assoc($selectdatabase);

	$_SESSION['Logo']=$result[Logo];
	$_SESSION['db']= $result[DatabaseName];
	mysql_close($connection);
}
$database = $_SESSION['db'];
	$mysqli = new mysqli("1.234.53.52", "cam", "5678","$database");
	//$mysqli = new mysqli("localhost", "root", "root","$database");
	$query = mysqli_query($mysqli,"call getTotalDocument($id_employee)");	
	while($row = mysqli_fetch_array($query)){
		$num_re_pending = $row[RePendingDoc];
		$num_re_not_approve = $row[ReNotApprovedDoc];
		$num_re_approved= $row[ReApprovedDoc];
		
		$num_meeting= $row[ReMeetingDoc];
		$num_re_declined = $row[ReDeclinedDoc];
		$num_re_reference_approved = $row[ReRefApprovedDoc];
		$num_re_reference_waiting = $row[ReRefWaitingDoc];
		$num_re_received_metting = $row[ReMeetingDoc];
		
		
		$num_my_sendingDoc=$row[MySendingDoc];
		$num_my_savedDoc=$row[MySavedDoc];
		$num_my_approveDoc=$row[MyApproveDoc];
		$num_my_declinedDoc=$row[MyDeclinedDoc];
		$num_my_meetingDoc=$row[MyMeetingDoc];
		
		$num_bin_re_doc = $row[BinReceiverDoc];
		$num_bin_se_doc = $row[BinSendingDoc];
	}
	
	mysqli_close($mysqli);
?>